<!--# include virtual="/admin/common/html/header.html"-->
<body>
<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 首页 
	<span class="c-gray en">&gt;</span>造价指标 
	<span class="c-gray en">&gt;</span>指标分类 
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
		<i class="Hui-iconfont">&#xe68f;</i>
	</a>
</nav>
<table class="table">
	<tr width="100%" >
		<ul id="treeDemo" class="ztree"></ul>
	</tr>
</table>
<!--# include virtual="/admin/common/html/_footer.html"-->
<script type="text/javascript">
var setting = {
	view: {
		dblClickExpand: true,
		showLine: true,
		selectedMulti: true
	},
	data: {
		simpleData: {
			enable:true,
			idKey: "fieldId",
			pIdKey: "fieldParantId",
			rootPId: ""
		},
		key:{
			name: "fieldName"
		}
	},
	edit: {
		enable: true,
		editNameSelectAll: true,
		removeTitle: "删除节点",
		renameTitle: "编辑节点名称",
		showRemoveBtn: true,
		showRenameBtn: true,
		drag: {
			autoExpandTrigger: true,
			isCopy: true,
			isMove: true,
			inner: false,
			borderMax: 20,
			borderMin: -10,
			minMoveSize: 10,
			maxShowNodeNum: 10,
			autoOpenTime: 0
		}
	},
	callback: {
		beforeClick: function(treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("tree");
			if (treeNode.isParent) {
				zTree.expandNode(treeNode);
				return false;
			} else {
				demoIframe.attr("src","_form.html?fieldId="+treeNode.fieldId);
				return true;
			}
		}
	}
};
$.post('/guidance_service/front/policies/field/search.do',{},function(obj){
	var data = obj.data;
	var list = new Array();
	var t = $("#treeDemo");
	t = $.fn.zTree.init(t, setting, data);
	demoIframe = $("#testIframe");
	var zTree = $.fn.zTree.getZTreeObj("tree");
});
var code;
function showCode(str) {
	if (!code) code = $("#code");
	code.empty();
	code.append("<li>"+str+"</li>");
}
</script>
<script type="text/javascript">
function GetQueryString(name){
 	var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
 	var r = window.location.search.substr(1).match(reg);
 	if(r!=null)return  unescape(r[2]); return null; 
}
$(function(){
	var policiesId=GetQueryString("policiesId");
	var fieldId=GetQueryString("fieldId");
	//console.log('policiesId==='+policiesId);
	if(policiesId){
		$("#tree_td").attr("style","display: none;");
		$("#testIframe").attr("src","_form.html?policiesId="+policiesId+"&fieldId="+fieldId);
	}
});
</script>
</body>
</html>